package org.thraex.fs.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
import org.thraex.base.result.Result;

/**
 * @author 鬼王
 * @date 2019/11/29 18:36
 */
//@EnableWebMvc
//@Configuration
@Deprecated
public class GlobalReturnConfig {

    //@RestControllerAdvice
    //static class ResultResponseAdvice implements ResponseBodyAdvice {
    //
    //    @Override
    //    public boolean supports(MethodParameter returnType, Class converterType) {
    //        return true;
    //    }
    //
    //    @Override
    //    public Object beforeBodyWrite(
    //            Object body,
    //            MethodParameter returnType,
    //            MediaType selectedContentType,
    //            Class selectedConverterType,
    //            ServerHttpRequest request,
    //            ServerHttpResponse response) {
    //
    //        return new Result<>().ok(body);
    //    }
    //}

}
